* ACTIVATING ANIMUS:  THE UNIQUELY SOCIAL ROOTS OF TRUMP SUPPORT
**Mason, Wronski, and Kane 2021
**REPLICATION CODE for MAIN TEXT

clear
**load data from "https://www.voterstudygroup.org/publication/2018-voter-survey-1"
use "VOTER_Survey_April18_Release1.dta"

*Install packages
net install dm7, from("http://www.stata.com/stb/stb7") // omscore function to reverse variables
net install combomarginsplot, from("http://fmwww.bc.edu/RePEc/bocode/c") // combomarginsplot command
net install blindschemes, from("http://fmwww.bc.edu/RePEc/bocode/b")
net install blindschemes_fix, from("http://digital.cgdev.org/doc/stata/MO/Misc")

*Set graph scheme
set scheme plotplain


/*
*******************
COVARIATES (all measured baseline=2011)
******************* 
*/

	*Party Identification Scale
recode pid7_baseline (8=4), gen(pid7_baseline_clean)
gen pid7_baseline_clean_01=(pid7_baseline_clean-1)/6

	**2011 trichotomous PID 1=Dems, 2=Ind, 3=Reps
gen pid_baseline3 = .
recode pid_baseline3 .=1 if pid7_baseline_clean_01<.5
recode pid_baseline3 .=2 if pid7_baseline_clean_01==.5
recode pid_baseline3 .=3 if pid7_baseline_clean_01>.5 & pid7_baseline_clean_01<=1
label define pid_baseline3 1 "Democrats" 2 "Independents" 3 "Republicans"
label values pid_baseline3 pid_baseline3

	*Ideology
recode ideo5_baseline (6=3), gen(Ideo_baseline_cleaned)
gen Ideo_baseline_cleaned_01=(Ideo_baseline_cleaned-1)/4

	*Income
recode faminc_baseline (31=12),gen (faminc_baseline_clean)
tabstat faminc_baseline_clean if faminc_baseline_clean<=12, statistics(mean p50)
recode faminc_baseline_clean (97=6)  // recoded "prefer not to say" (11.55%) to median value
gen faminc_baseline_clean_01=(faminc_baseline_clean-1)/11

	*Political Interest
omscore polinterest_baseline
gen rr_polinterest_baseline_01=(rr_polinterest_baseline-1)/3

	*Gender
gen female_baseline=gender_baseline-1

	*Age
gen age_baseline=2011-birthyr_baseline
gen age2011decades=age_baseline/10

/*
*******************
GROUP ANIMUS
******************* 
*/

*Democratic Group Animus
gen BlackFT11=blacks_t_baseline if blacks_t_baseline<=100
gen HispFT11=latinos_t_baseline if latinos_t_baseline<=100
gen MuslimFT11=muslims_t_baseline if muslims_t_baseline<=100
gen GaysLesbiansFT11=gays_t_baseline if gays_t_baseline<=100

gen BlackFT11_01=(BlackFT11)/100
gen HispFT11_01=(HispFT11)/100
gen MuslimFT11_01=(MuslimFT11)/100
gen GaysLesbiansFT11_01=(GaysLesbiansFT11)/100

omscore BlackFT11_01
omscore HispFT11_01 
omscore MuslimFT11_01 
omscore GaysLesbiansFT11_01

	*Democratic Groups Combined
egen demgroupsFT11=rmean(BlackFT11_01 HispFT11_01 MuslimFT11_01 GaysLesbiansFT11_01)
omscore demgroupsFT11
label var rr_demgroupsFT11 "Animus Toward Democratic Groups (2011)"


*Republican Group Animus
gen ChristiansFT11=christians_t_baseline if christians_t_baseline<=100
gen WhiteFT11=whites_t_baseline if whites_t_baseline<=100

gen WhiteFT11_01=(WhiteFT11)/100
gen ChristiansFT11_01=(ChristiansFT11)/100

	*Republican Groups Combined
egen gopgroupsFT11=rmean(WhiteFT11_01 ChristiansFT11_01)
omscore gopgroupsFT11
label var rr_gopgroupsFT11 "Animus Toward Republican Groups (2011)"


/*
*******************
SUPPORT FOR TRUMP
******************* 
*/

recode trumpapp_2017 (1=5) (2=4) (3=2) (4=1) (5=3),gen(TrumpPresApproval17)
gen TrumpPresApproval1701=(TrumpPresApproval17-1)/4

gen Trumpfav1701=fav_trump_2017
recode Trumpfav1701 8=.
omscore Trumpfav1701
replace Trumpfav1701=(rr_Trumpfav1701-1)/3

recode trumpapp_2018 (1=5) (2=4) (3=2) (4=1) (5=3),gen(TrumpPresApproval18)
gen TrumpPresApproval1801=(TrumpPresApproval18-1)/4


gen Trumpfav1801=fav_trump_2018
recode Trumpfav1801 8=.
omscore Trumpfav1801
replace Trumpfav1801=(rr_Trumpfav1801-1)/3

/*
*********************************
REPUBLICAN ELITE & PARTY SUPPORT
*********************************
*/
gen Ryanfav1801=fav_ryan_2018
recode Ryanfav1801 8=.
omscore Ryanfav1801
replace Ryanfav1801=(rr_Ryanfav1801-1)/3

gen Mcconfav1801=fav_mcconnell_2018
recode Mcconfav1801 8=.
omscore Mcconfav1801
replace Mcconfav1801=(rr_Mcconfav1801-1)/3

gen GOPFT17_01=ft_rep_2017 if ft_rep_2017<=100
replace GOPFT17_01 = (GOPFT17_01/100)


/*
*********************************
DEMOCRATIC ELITE & PARTY SUPPORT
********************************* 
*/

gen Clintonfav1801=fav_hrc_2018
recode Clintonfav1801 8=.
omscore Clintonfav1801
replace Clintonfav1801=(rr_Clintonfav1801-1)/3

gen Obamafav1801=fav_obama_2018
recode Obamafav1801 8=.
omscore Obamafav1801
replace Obamafav1801=(rr_Obamafav1801-1)/3

gen Sandersfav1801=fav_sanders_2018
recode Sandersfav1801 8=.
omscore Sandersfav1801
replace Sandersfav1801=(rr_Sandersfav1801-1)/3

gen Schumerfav1801=fav_schumer_2018
recode Schumerfav1801 8=.
omscore Schumerfav1801
replace Schumerfav1801=(rr_Schumerfav1801-1)/3

gen Pelosifav1801=fav_pelosi_2018
recode Pelosifav1801 8=.
omscore Pelosifav1801
replace Pelosifav1801=(rr_Pelosifav1801-1)/3

gen DemFT17_01=ft_dem_2017 if ft_dem_2017<=100
replace DemFT17_01 = (DemFT17_01/100)


************************
*MODELS & FIGURES
************************

*Note:  Some figures underwent minor manual editing after being generated

**FIGURE 1 Models & Code

**DV=Trump Favorability 2017-18 
reg TrumpPresApproval1701 rr_demgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 

margins, at(rr_demgroupsFT11=(0 (.1) 1)) atmeans saving(file1, replace)

reg Trumpfav1701 rr_demgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 

margins, at(rr_demgroupsFT11=(0 (.1) 1)) atmeans saving(file2, replace)

reg TrumpPresApproval1801 rr_demgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 

margins, at(rr_demgroupsFT11=(0 (.1) 1)) atmeans saving(file3, replace)

reg Trumpfav1801 rr_demgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 

margins, at(rr_demgroupsFT11=(0 (.1) 1)) atmeans saving(file4, replace)

	*Produce Figure 1
combomarginsplot file1 file2 file3 file4, ///
legend(pos(6)) legend(row(1)) ///
labels("Trump Approval 2017" "Trump Favorability 2017" "Trump Approval 2018" "Trump Favorability 2018") 

*FIGURE 2:  Democratic Group Animus, GOP DVs 2017-2018

reg Trumpfav1801  rr_demgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 
margins, at(rr_demgroupsFT11=(0 (.1) 1)) atmeans saving(file1, replace)


reg Ryanfav1801  rr_demgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 

margins, at(rr_demgroupsFT11=(0 (.1) 1)) atmeans saving(file2, replace)

reg Mcconfav1801  rr_demgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 

margins, at(rr_demgroupsFT11=(0 (.1) 1)) atmeans saving(file3, replace)


reg GOPFT17_01 rr_demgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 

margins, at(rr_demgroupsFT11=(0 (.1) 1)) atmeans saving(file4, replace)

	*Produce Figure 2
combomarginsplot file1 file2 file3 file4, ///
labels("Trump" "Ryan" "McConnell" "GOP") /// 
legend(on order(1 "Trump" 2 "Ryan" 3 "McConnell" 4 "GOP") ring(1) pos(6) colfirst col(5)) ///
graphregion(margin(vsmall)) scheme(plotplain) ///
addplot(hist rr_demgroupsFT11,  title( " ") ytitle("Favorability (2017-2018)", size(med)) xtitle("Animus Toward Democratic Groups (2011)", size(medsmall)) ///
yaxis(2) yscale(alt axis(2)) percent ///
ylabel(1 "1%" 2 "2%" 3 "3%" 4 "4%" 5 "5%" 6 "6%" 7 "7%" 8 "8%" 9 "9%" 10 "10%", labcolor(black*.9) axis(2)) ///
ytitle("Percent of Sample", axis(2) orientation(rvertical)) ylabel(0(.1)1) fcolor(white%10) lcolor(black*.5)) ///
xsize(6.5) ysize(4.5) 

**Republican Groups (Whites/Christians) animus and Trump/Rep Party support
**negative coefficients reflect less support when more GOP-aligned group animus
**Trump -- GOP estimate -0.212 (p<.01)
reg Trumpfav1801  rr_gopgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 

**Paul Ryan -- GOP estimate -0.202 (p<.01)
reg Ryanfav1801  rr_gopgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 

**McConnell -- GOP estimate -0.157 (p<.01)
reg Mcconfav1801  rr_gopgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 

**Republican Party -- GOP estimate -0.321 (p<.01)
reg GOPFT17_01 rr_gopgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 



*FIGURE 3:  Dem Group Animus and Trump Support with interaction by 2011 PID
reg Trumpfav1801  c.rr_demgroupsFT11##i.pid_baseline3 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 

margins, at(rr_demgroupsFT11=(0 (.1) 1) pid_baseline3=(1 2 3)) atmeans saving(file1, replace)

	*Produce Figure 3
marginsplot, xtitle ("Animus Toward Democratic Groups (2011)") ytitle ("Trump Favorability (2018)") title ("") ///
legend(pos(6)) legend(row(1))


**Footnote 12: effects of Democratic group animus by PID for each group
**African-Americans: sig effects for R's & D's; NO EFFECT for I's
reg Trumpfav1801  c.rr_BlackFT11_01##i.pid_baseline3 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust
margins, dydx(rr_BlackFT11_01) at(pid_baseline3=(1 2 3)) atmeans
margins, at(rr_BlackFT11_01=(0 (.1) 1) pid_baseline3=(1 2 3)) atmeans
marginsplot, xtitle ("Animus Toward African-Americans (2011)") 

**Hispanics: sig p<.05 effects for R's & D's; sig p<.1 effect for I's
reg Trumpfav1801  c.rr_HispFT11_01##i.pid_baseline3 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust
margins, dydx(rr_HispFT11_01) at(pid_baseline3=(1 2 3)) atmeans
margins, at(rr_HispFT11_01=(0 (.1) 1) pid_baseline3=(1 2 3)) atmeans
marginsplot, xtitle ("Animus Toward Hispanics (2011)") 

**Muslims: sig for all groups at p<.01, largest effect for I's (.285)
reg Trumpfav1801  c.rr_MuslimFT11_01##i.pid_baseline3 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust
margins, dydx(rr_MuslimFT11_01) at(pid_baseline3=(1 2 3)) atmeans
margins, at(rr_MuslimFT11_01=(0 (.1) 1) pid_baseline3=(1 2 3)) atmeans 
marginsplot, xtitle ("Animus Toward Muslims (2011)") 

**LGBT: sig for all groups at p<.01, largest effect for I's (.387) compared to .1 for R's and .12 for D's
reg Trumpfav1801  c.rr_GaysLesbiansFT11_01##i.pid_baseline3 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust
margins, dydx(rr_GaysLesbiansFT11_01) at(pid_baseline3=(1 2 3)) atmeans
margins, at(rr_GaysLesbiansFT11_01=(0 (.1) 1) pid_baseline3=(1 2 3)) atmeans
marginsplot, xtitle ("Animus Toward LGBT (2011)") 



*FIGURE 4:  GOP Group Animus, Democratic DVs 2017-2018

reg Clintonfav1801  rr_gopgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 
margins, at(rr_gopgroupsFT11=(0 (.1) 1)) atmeans saving(file1, replace)


reg Sandersfav1801  rr_gopgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 
margins, at(rr_gopgroupsFT11=(0 (.1) 1)) atmeans saving(file2, replace)


reg Schumerfav1801  rr_gopgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 
margins, at(rr_gopgroupsFT11=(0 (.1) 1)) atmeans saving(file3, replace)


reg Pelosifav1801  rr_gopgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 
margins, at(rr_gopgroupsFT11=(0 (.1) 1)) atmeans saving(file4, replace)


reg DemFT17_01  rr_gopgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 
margins, at(rr_gopgroupsFT11=(0 (.1) 1)) atmeans saving(file5, replace)

	*Produce Figure 4
combomarginsplot file1 file2 file3 file4 file5, ///
labels("Clinton" "Sanders" "Schumer" "Pelosi" "Democratic Party") ///
legend(on order(1 "Clinton" 2 "Sanders" 3 "Schumer" 4 "Pelosi" 5 "Democratic Party") ring(1) pos(6) colfirst col(6)) ///
graphregion(margin(vsmall)) scheme(plotplain) ///
addplot(hist rr_gopgroupsFT11,  title( " ") ytitle("Approval (2017-2018)", size(med)) xtitle("Animus Toward Republican Groups (2011)", size(medsmall)) ///
yaxis(2) yscale(alt axis(2)) percent ///
ylabel(1 "1%" 2 "2%" 3 "3%" 4 "4%" 5 "5%" 6 "6%" 7 "7%" 8 "8%" 9 "9%" 10 "10%" 11 "11%" 12 "12%" 13 "13%" 14 "14%" 15 "15%", labcolor(black*.9) axis(2)) ///
ytitle("Percent of Sample", axis(2) orientation(rvertical))  fcolor(white%10) lcolor(black*.5)) ///
xsize(6.5) ysize(4.5) 


*FIGURE 5:  Nonlinearity in Relation Between Democratic Group Animus & Trump Support

reg Trumpfav1801  c.rr_demgroupsFT11##c.rr_demgroupsFT11 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 

margins, at(rr_demgroupsFT11=(0(.1)1)) 

	*Produce Figure 5
marginsplot, scheme(plotplain) ytitle("Favorability toward Trump (2018)") ///
title("") recastci(rarea) ciopts(fcolor(gs10))


**FIGURE 6:  Trump Support & Animus toward Each Democratic Group

	*AFRICAN-AMERICANS
label var rr_BlackFT11_01 "Animosity Toward Blacks 2011"
	*Linear model:
reg Trumpfav1801  c.rr_BlackFT11_01 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01
margins, at(rr_BlackFT11_01=(0 (.1) 1)) saving(file1, replace)

	*Non-linear model: 
reg Trumpfav1801  c.rr_BlackFT11_01##c.rr_BlackFT11_01 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01
margins, at(rr_BlackFT11_01=(0 (.1) 1)) saving(file2, replace)

combomarginsplot file1 file2, ///
legend(off) ///
graphregion(margin(vsmall)) scheme(plotplain) ///
addplot(hist rr_BlackFT11_01,  title( " ") ytitle("Trump Favorability (2018)", size(med)) xtitle("Animus Toward African-Americans (2011)", size(medsmall)) ///
yaxis(2) yscale(alt axis(2)) percent ///
ylabel(1 "1%" 2 "2%" 3 "3%" 4 "4%" 5 "5%" 6 "6%" 7 "7%" 8 "8%" 9 "9%" 10 "10%" 11 "11%" 12 "12%" 13 "13%" 14 "14%" 15 "15%", labcolor(black*.9) axis(2)) ///
ytitle("", axis(2) orientation(rvertical)) ylabel(.25(.05).60) fcolor(white%10) lcolor(black*.5)) legend(off)
graph save "Trump_AfricanAmericans", replace


*HISPANICS
label var rr_HispFT11_01 "Animosity Toward Hispanics 2011"
	*Linear model:  
reg Trumpfav1801  c.rr_HispFT11_01 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 
margins, at(rr_HispFT11_01=(0 (.1) 1)) saving(file1, replace)

	*Non-linear model:  
reg Trumpfav1801  c.rr_HispFT11_01##c.rr_HispFT11_01 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 
margins, at(rr_HispFT11_01=(0 (.1) 1)) saving(file2, replace)

combomarginsplot file1 file2 , ///
legend(off) ///
graphregion(margin(vsmall)) scheme(plotplain) ///
addplot(hist rr_HispFT11_01,  title( " ") ytitle("", size(med)) xtitle("Animus Toward Hispanics (2011)", size(medsmall)) ///
yaxis(2) yscale(alt axis(2)) percent ///
ylabel(1 "1%" 2 "2%" 3 "3%" 4 "4%" 5 "5%" 6 "6%" 7 "7%" 8 "8%" 9 "9%" 10 "10%" 11 "11%" 12 "12%" 13 "13%" 14 "14%" 15 "15%", labcolor(black*.9) axis(2)) ///
ytitle("Percent of Sample", axis(2) orientation(rvertical)) ylabel(.25(.05).60)  fcolor(white%10) lcolor(black*.5)) legend(off)
graph save "Trump_Hispanics", replace


*MUSLIMS
label var rr_MuslimFT11_01 "Animosity Toward Muslims 2011"
	*Linear: 
reg Trumpfav1801  c.rr_MuslimFT11_01 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 
margins, at(rr_MuslimFT11_01=(0 (.1) 1)) saving(file1, replace)

	*Non-linear: 
reg Trumpfav1801  c.rr_MuslimFT11_01##c.rr_MuslimFT11_01 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 
margins, at(rr_MuslimFT11_01=(0 (.1) 1)) saving(file2, replace)

combomarginsplot file1 file2 , ///
legend(off)  ///
graphregion(margin(vsmall)) scheme(plotplain) ///
addplot(hist rr_MuslimFT11_01,  title( " ") ytitle("Trump Favorability (2018)", size(med)) xtitle("Animus Toward Muslims (2011)", size(medsmall)) ///
yaxis(2) yscale(alt axis(2)) percent ///
ylabel(1 "1%" 2 "2%" 3 "3%" 4 "4%" 5 "5%" 6 "6%" 7 "7%" 8 "8%" 9 "9%" 10 "10%" 11 "11%" 12 "12%" 13 "13%" 14 "14%" 15 "15%", labcolor(black*.9) axis(2)) ///
ytitle("", axis(2) orientation(rvertical))  ylabel(.25(.05).60) fcolor(white%10) lcolor(black*.5))
graph save "Trump_Muslims", replace


*GAYS & LESBIANS
label var rr_GaysLesbiansFT11_01 "Animosity Toward Gays/Lesbians 2011"
	*Linear: 
reg Trumpfav1801  c.rr_GaysLesbiansFT11_01 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 
margins, at(rr_GaysLesbiansFT11_01=(0 (.1) 1)) saving(file1, replace)


	*Non-Linear:  
reg Trumpfav1801  c.rr_GaysLesbiansFT11_01##c.rr_GaysLesbiansFT11_01 pid7_baseline_clean_01 Ideo_baseline_cleaned_01 /// 
i.educ_baseline i.race_baseline i.religpew_baseline age2011decades female_baseline faminc_baseline_clean_01 rr_polinterest_baseline_01, robust 

margins, at(rr_GaysLesbiansFT11_01=(0 (.1) 1)) saving(file2, replace)

combomarginsplot file1 file2 , ///
legend(off) ///
graphregion(margin(vsmall)) scheme(plotplain) ///
addplot(hist rr_GaysLesbiansFT11_01,  title( " ") ytitle("", size(med)) xtitle("Animus Toward Gays & Lesbians (2011)", size(medsmall)) ///
yaxis(2) yscale(alt axis(2)) percent ///
ylabel(1 "1%" 2 "2%" 3 "3%" 4 "4%" 5 "5%" 6 "6%" 7 "7%" 8 "8%" 9 "9%" 10 "10%" 11 "11%" 12 "12%" 13 "13%" 14 "14%" 15 "15%", labcolor(black*.9) axis(2)) ///
ytitle("Percent of Sample", axis(2) orientation(rvertical)) ylabel(.25(.05).60)  fcolor(white%10) lcolor(black*.5))
graph save "Trump_GaysLesbians", replace


	*Combine four graphs into one graph with  four panels
graph combine Trump_AfricanAmericans.gph Trump_Hispanics.gph Trump_Muslims.gph Trump_GaysLesbians.gph, ///
scheme(plotplain) col(2) ///
xsize(6.5) ysize(4.5) iscale(.7) 



**********************************************
*METRICS FOR INTERNAL CONSISTENCY OF ANIMUS SCALES 
**********************************************

*2011 Measures
* Democratic Groups
alpha rr_BlackFT11_01 rr_HispFT11_01 rr_MuslimFT11_01 rr_GaysLesbiansFT11_01, item // alpha=.78
factor rr_BlackFT11_01 rr_HispFT11_01 rr_MuslimFT11_01 rr_GaysLesbiansFT11_01, factors(1)

*Republican Groups 
alpha WhiteFT11_01 ChristiansFT11_01, item // alpha=.61
pwcorr WhiteFT11_01 ChristiansFT11_01, sig // r=.46, p<.001


*2016 Measures
*Democratic groups
gen BlackFT16=ft_black_2016 if ft_black_2016<=100
gen HispFT16=ft_hisp_2016 if ft_hisp_2016<=100
gen MuslimFT16=ft_muslim_2016 if ft_muslim_2016!=997
gen GaysLesbiansFT16= ft_gays_2016 if ft_gays_2016!=997
tab1 MuslimFT16 GaysLesbiansFT16

alpha BlackFT16 HispFT16 MuslimFT16 GaysLesbiansFT16, item // alpha=.83
factor BlackFT16 HispFT16 MuslimFT16 GaysLesbiansFT16, factors(1)


*Republican Groups
tab1 ft_christ_2016 ft_white_2016, nol

gen WhitesFT16=ft_white_2016 if ft_white_2016!=997
gen ChristiansFT16=ft_christ_2016 if ft_christ_2016!=997

tab1 WhitesFT16 ChristiansFT16

alpha WhitesFT16 ChristiansFT16, item // alpha=.64
pwcorr WhitesFT16 ChristiansFT16, sig // r=.49 , p<.001

